import {
	myRequest
} from '@/util/api.js'
import common from '@/util/util'
// 显示资产的接口方法
// basicUrl:基准路由
// type：什么提交类型
// resource：传入的资源
// params：正常的参数
// 后拼接的路由
export function calCulatePrice(params, type, resource, secondUrl) {
	const basicUrl = '/wx/biz/calCulatePrice'
	return myRequest({
		url: common.getUrl(basicUrl, resource, secondUrl),
		method: type,
		data: ['put', 'post', 'get', 'delete'].indexOf(type) >= 0 ? params : null,
	})
}
export function addOrder(params, type, resource, secondUrl) {
	const basicUrl = '/wx/biz/addOrder'
	return myRequest({
		url: common.getUrl(basicUrl, resource, secondUrl),
		method: type,
		data: ['put', 'post', 'get', 'delete'].indexOf(type) >= 0 ? params : null,
	})
}
export function countOrderPrice(params, type, resource, secondUrl) {
	const basicUrl = '/wx/biz/countOrderPrice'
	return myRequest({
		url: common.getUrl(basicUrl, resource, secondUrl),
		method: type,
		data: ['put', 'post', 'get', 'delete'].indexOf(type) >= 0 ? params : null,
	})
}


export function cargoTypeList(params, type, resource, secondUrl) {
	const basicUrl = '/wx/biz/cargoTypeList'
	return myRequest({
		url: common.getUrl(basicUrl, resource, secondUrl),
		method: type,
		data: ['put', 'post', 'get', 'delete'].indexOf(type) >= 0 ? params : null,
	})
}
export function cargoTemplateList(params, type, resource, secondUrl) {
	const basicUrl = '/wx/biz/cargoTemplateList'
	return myRequest({
		url: common.getUrl(basicUrl, resource, secondUrl),
		method: type,
		data: ['put', 'post', 'get', 'delete'].indexOf(type) >= 0 ? params : null,
	})
}

//用户订单列表
export function wxOrderList(params, type, resource, secondUrl) {
	const basicUrl = '/wx/biz/wxOrderList'
	return myRequest({
		url: common.getUrl(basicUrl, resource, secondUrl),
		method: type,
		data: ['put', 'post', 'get', 'delete'].indexOf(type) >= 0 ? params : null,
	})
}

// 取消订单
export function cancelOrder(params, type, resource, secondUrl) {
	const basicUrl = '/wx/biz/cancelOrder'
	return myRequest({
		url: common.getUrl(basicUrl, resource, secondUrl),
		method: type,
		data: ['put', 'post', 'get', 'delete'].indexOf(type) >= 0 ? params : null,
	})
}

// 详情
export function queryCoordinate(params, type, resource, secondUrl) {
	const basicUrl = '/wx/biz/queryCoordinate'
	return myRequest({
		url: common.getUrl(basicUrl, resource, secondUrl),
		method: type,
		data: ['put', 'post', 'get', 'delete'].indexOf(type) >= 0 ? params : null,
	})
}

// 退款
export function refundAPI(params, type, resource, secondUrl) {
	const basicUrl = '/wx/biz/refund'
	return myRequest({
		url: common.getUrl(basicUrl, resource, secondUrl),
		method: type,
		data: ['put', 'post', 'get', 'delete'].indexOf(type) >= 0 ? params : null,
	})
}

// 回调
export function notifyAPI(params, type, resource, secondUrl) {
	const basicUrl = '/wx/biz/changeOrderStatus'
	return myRequest({
		url: common.getUrl(basicUrl, resource, secondUrl),
		method: type,
		data: ['put', 'post', 'get', 'delete'].indexOf(type) >= 0 ? params : null,
	})
}

// 查询                   
export function listSerach(params, type, resource, secondUrl) {
	const basicUrl = '/wx/biz/wxSerachOrderList'
	return myRequest({
		url: common.getUrl(basicUrl, resource, secondUrl),
		method: type,
		data: ['put', 'post', 'get', 'delete'].indexOf(type) >= 0 ? params : null,
	})
}
export function lineList(params, type, resource, secondUrl) {
	const basicUrl = '/wx/biz/lineList'
	return myRequest({
		url: common.getUrl(basicUrl, resource, secondUrl),
		method: type,
		data: ['put', 'post', 'get', 'delete'].indexOf(type) >= 0 ? params : null,
	})
}
// 用户地址
export function businessAddress(params, type, resource, secondUrl) {
	const basicUrl = '/wx/address'
	return myRequest({
		url: common.getUrl(basicUrl, resource, secondUrl),
		method: type,
		data: ['put', 'post', 'get', 'delete'].indexOf(type) >= 0 ? params : null,
	})
}
// 用户地址列表
export function addressList(params, type, resource, secondUrl) {
	const basicUrl = '/wx/address/list'
	return myRequest({
		url: common.getUrl(basicUrl, resource, secondUrl),
		method: type,
		data: ['put', 'post', 'get', 'delete'].indexOf(type) >= 0 ? params : null,
	})
}

// 时间倒计时
export function countdown(params, type, resource, secondUrl) {
	const basicUrl = '/wx/biz/countdown'
	return myRequest({
		url: common.getUrl(basicUrl, resource, secondUrl),
		method: type,
		data: ['put', 'post', 'get', 'delete'].indexOf(type) >= 0 ? params : null,
	})
}

// 评论
export function comment(params, type, resource, secondUrl) {
	const basicUrl = '/wx/comment'
	return myRequest({
		url: common.getUrl(basicUrl, resource, secondUrl),
		method: type,
		data: ['put', 'post', 'get', 'delete'].indexOf(type) >= 0 ? params : null,
	})
}

// 补交费用
export function supplement(params, type, resource, secondUrl) {
	const basicUrl = '/wx/biz/supplement'
	return myRequest({
		url: common.getUrl(basicUrl, resource, secondUrl),
		method: type,
		data: ['put', 'post', 'get', 'delete'].indexOf(type) >= 0 ? params : null,
	})
}

// 补交费用支付订单
export function bjPrepay(params, type, resource, secondUrl) {
	const basicUrl = '/wx/biz/bjPrepay'
	return myRequest({
		url: common.getUrl(basicUrl, resource, secondUrl),
		method: type,
		data: ['put', 'post', 'get', 'delete'].indexOf(type) >= 0 ? params : null,
	})
}

// 搜索
export function areacodeSearch(params, type, resource, secondUrl) {
	const basicUrl = '/wx/biz/getAddrInfo'
	return myRequest({
		url: common.getUrl(basicUrl, resource, secondUrl),
		method: type,
		data: ['put', 'post', 'get', 'delete'].indexOf(type) >= 0 ? params : null,
	})
}




//订单详情
export function orderInfo(params, type, resource, secondUrl) {
	const basicUrl = '/wx/biz/getOrderById'
	return myRequest({
		url: common.getUrl(basicUrl, resource, secondUrl),
		method: type,
		data: ['put', 'post', 'get', 'delete'].indexOf(type) >= 0 ? params : null,
	})
}


//APP端微信登录
export function wxLogin_app(params, type, resource, secondUrl) {
  const basicUrl = '/auth/login/wxLogin?code=' + params.code
  // console.log(common.getUrl(basicUrl, resource, secondUrl))
  // return
  return myRequest({
    url: common.getUrl(basicUrl, resource, secondUrl),
    method: type,
	data: ['put', 'post', 'get', 'delete'].indexOf(type) >= 0 ? params : null,
	ifToken:true
  })
}


// APP端绑定手机号
export function bingPhone(params, type, resource, secondUrl) {
  const basicUrl = '/auth/login/bingPhone'
  return myRequest({
    url: common.getUrl(basicUrl, resource, secondUrl),
    method: type,
	data: ['put', 'post', 'get', 'delete'].indexOf(type) >= 0 ? params : null,
	ifToken:true
  })
}